package com.icomvn.game.pikachu.utility;

import com.icomvn.game.pikachu.object.CountDownTimer;
import com.icomvn.game.pikachu.play.PlayPikachu;

public class TimeCount extends CountDownTimer {
	long maxTime = 0;
	PlayPikachu play=null;
	public int timeSave;
	public TimeCount(long millisInFuture, long countDownInterval,PlayPikachu play) {
		super(millisInFuture, countDownInterval);
		maxTime=millisInFuture;
		this.play=play;
	}

	@Override
	public void onFinish() {
		play.timeEnd();
	}

	@Override
	public void onTick(long millisUntilFinished) {
		timeSave = (int) millisUntilFinished / 1000;
		int second = timeSave / 60;
		int mid = timeSave % 60;
		String result = "";
		if (second < 10)
			result = result + "0" + String.valueOf(second);
		else
			result = result + String.valueOf(second);
		if (mid < 10)
			result = result + ":0" + String.valueOf(mid);
		else
			result = result + ":" + String.valueOf(mid);
	}
	
}